package cc.lj.internal.merchant.domain.contract.service.impl;

import cc.lj.internal.merchant.domain.contract.model.vo.PropertyRelationDO;
import cc.lj.internal.merchant.domain.contract.model.vo.convert.PropertyRelationPOConvertDO;
import cc.lj.internal.merchant.domain.contract.repository.IPropertyRelationRepository;
import cc.lj.internal.merchant.domain.contract.service.IPropertyRelationDomainService;
import cc.lj.internal.merchant.infrastructure.po.PropertyRelationPO;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * 物业资源分类表 domain service 实现
 * @author liangxifeng
 * @date 2021-12-25
 */
@Service(value = "propertyRelationDomainServiceImpl")
public class PropertyRelationDomainServiceImpl implements IPropertyRelationDomainService {
    @Resource(name = "propertyRelationMysqlRespository")
    private IPropertyRelationRepository relationRepository;
    @Override
    public List<PropertyRelationDO> getList(PropertyRelationDO relationDO) {
        PropertyRelationPO relationPO = PropertyRelationPOConvertDO.INSTANCE.convert(relationDO);
        List<PropertyRelationPO> relationPOList = relationRepository.getList(relationPO);
        List<PropertyRelationDO> relationDOList = new ArrayList<>();
        for (PropertyRelationPO propertyRelationPO : relationPOList) {
            PropertyRelationDO relationDO1 = PropertyRelationPOConvertDO.INSTANCE.convert(propertyRelationPO);
            relationDOList.add(relationDO1);
        }
        return relationDOList;
    }
}
